﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<zeus.Core.Usuario>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">

    <h2>Nuevo Usuario</h2>
    <% Html.EnableClientValidation(); %>

    <% using (Html.BeginForm()) {%>
        <%: Html.ValidationSummary(true) %>
        
        <fieldset>
            <legend>Información de acceso</legend>
            <div class="leftField">
                <div class="editor-label">
                    <%: Html.LabelFor(model => model.Login) %>
                </div>
                <div class="editor-field">
                    <%: Html.TextBoxFor(model => model.Login) %>
                    <%: Html.ValidationMessageFor(model => model.Login) %>
                </div>
            </div>
            
            <div>
                <div class="editor-label">
                    <%: Html.LabelFor(model => model.Clave) %>
                </div>

                <div class="editor-field">
                    <%: Html.PasswordFor(model => model.Clave, new { value = Model.Clave })%>
                    <%: Html.ValidationMessageFor(model => model.Clave) %>
                </div>
            </div> 
                        
            <div class="editor-label">
                <%: Html.LabelFor(model => model.Nombre) %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.Nombre, new { width = "100px" })%>
                <%: Html.ValidationMessageFor(model => model.Nombre) %>
            </div>                               
            
            <% if (ViewData["RolUsuario"] != "usuario")
               { %>
            <div class="editor-label">
                <%: Html.LabelFor(model => model.Rol)%>
            </div>
            <div class="editor-field">
                <%: Html.DropDownList("Rol")%>
                <%: Html.ValidationMessageFor(model => model.Rol)%>
            </div>
            <% } %>
        </fieldset>


       <fieldset>
            <legend>Información de Ubicación</legend>
        
            <div class="editor-label">
                <%: Html.LabelFor(model => model.Empresa) %>
            </div>
            
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.Empresa) %>
                <%: Html.ValidationMessageFor(model => model.Empresa) %>
            </div>
        
            <div class="editor-label">
                <%: Html.LabelFor(model => model.Direccion) %>
            </div>
            <div class="editor-field">
                <%: Html.TextAreaFor(model => model.Direccion) %>
                <%: Html.ValidationMessageFor(model => model.Direccion) %>
            </div>
        
            <div class="leftField">
                <div class="editor-label">
                    <%: Html.LabelFor(model => model.CodigoPais) %>

                </div>
                <div class="editor-field">
                    <%: Html.DropDownList("CodigoPais") %>
                    <%: Html.ValidationMessageFor(model => model.CodigoPais) %>
                </div>
            </div>

            <div>
                <div class="editor-label">
                    <%: Html.LabelFor(model => model.Ciudad) %>
                </div>
                <div class="editor-field">
                    <%: Html.TextBoxFor(model => model.Ciudad) %>
                    <%: Html.ValidationMessageFor(model => model.Ciudad) %>
                </div>
            </div>
                
            <div class="editor-label">
                <%: Html.LabelFor(model => model.Postal) %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.Postal) %>
                <%: Html.ValidationMessageFor(model => model.Postal) %>
            </div>
            
            <div class="leftField">
                <div class="editor-label">
                    <%: Html.LabelFor(model => model.Telefono1) %>
                </div>
                <div class="editor-field">
                    <%: Html.TextBoxFor(model => model.Telefono1) %>
                    <%: Html.ValidationMessageFor(model => model.Telefono1) %>
                </div>
            </div>
        
            <div>
                <div class="editor-label">
                    <%: Html.LabelFor(model => model.Mail) %>
                </div>
                <div class="editor-field">
                    <%: Html.TextBoxFor(model => model.Mail) %>
                    <%: Html.ValidationMessageFor(model => model.Mail) %>
                </div>
            </div>
        </fieldset>
        
        <fieldset>
            <legend>Preferencias</legend>

            <div >
                <div class="editor-label">
                    <%: Html.LabelFor(model => model.CodigoIdioma) %>
                </div>
                <div class="editor-field">
                    <%: Html.DropDownList("CodigoIdioma")%>
                    <%: Html.ValidationMessageFor(model => model.CodigoIdioma) %>
                </div>
            </div>

           <%-- <div>
                <div class="editor-label">
                    <%: Html.LabelFor(model => model.ZonaHoraria) %>
                </div>
                <div class="editor-field">
                    <%: Html.DropDownList("ZonaHoraria") %>
                    <%: Html.ValidationMessageFor(model => model.ZonaHoraria) %>
                </div>
            </div>--%>
            
            <%--<div>
                <div class="editor-label">
                    <%: Html.LabelFor(model => model.Distancia) %>
                </div>           
            </div>
        
            <div class="editor-field" "leftField">
                <%: Html.DropDownList("Distancia") %>
                <%: Html.ValidationMessageFor(model => model.Distancia) %>
            </div>--%>
  
            <div>
                <div class="editor-label">
                    <%: Html.LabelFor(model => model.Velocidad) %>
                </div>
                <div class="editor-field">
                    <%: Html.DropDownList("Velocidad")%>
                    <%: Html.ValidationMessageFor(model => model.Velocidad) %>
                </div>
            </div>
        
            <%--<div class="editor-label">
                <%: Html.LabelFor(model => model.Mapa) %>
            </div>
            <div class="editor-field">
                <%: Html.DropDownList("Mapa")%>
                <%: Html.ValidationMessageFor(model => model.Mapa) %>
            </div>--%>
            
            <% if (ViewData["RolUsuario"] != "usuario")
               { %>
            <div class="editor-field">
                <%: Html.CheckBoxFor(model => model.MostrarUnidades)%>
                <%: Html.LabelFor(model => model.MostrarUnidades)%>
                <%: Html.ValidationMessageFor(model => model.MostrarUnidades)%>
            </div>
            
            <div class="editor-field">
                <%: Html.CheckBoxFor(model => model.MostrarCoordenadas)%>
                <%: Html.LabelFor(model => model.MostrarCoordenadas)%>
                <%: Html.ValidationMessageFor(model => model.MostrarCoordenadas)%>
            </div>
        
           <%-- <div class="editor-field">
                <%: Html.CheckBoxFor(model => model.MapaFlash) %>
                <%: Html.LabelFor(model => model.MapaFlash) %>
                <%: Html.ValidationMessageFor(model => model.MapaFlash) %>
            </div>--%>
                   
            <div class="editor-field">
                <%: Html.CheckBoxFor(model => model.Activo)%>
                <%: Html.LabelFor(model => model.Activo)%>
                <%: Html.ValidationMessageFor(model => model.Activo)%>                
            </div>

            <% } %>
        </fieldset>   
        
        <% if (ViewData["RolUsuario"] != "usuario")
           { %>
        <fieldset>
            <legend>Permisos</legend>
            <%foreach (var item in Model.UsuarioReportes)
              {
                  if (item.Reporte.Activo)
                  {%>
                  <div class="editor-field">
                      <%= Html.CheckBox(item.Reporte.Id.ToString(), item.Estado, new { id = item.Reporte.Id })%>
                      <label for="<%= item.Reporte.Id %>"><%= item.Reporte.Nombre%></label>
                  </div>
                  <%
                  }
              } %>
        </fieldset>    
        <% } %>     
        
        <%: Html.HiddenFor(model=>model.CodigoCliente) %>
                           
        <p>
            <input type="submit" value="Guardar" />
             <%if (Model.Id > 0 && ViewData["RolUsuario"] != "usuario")
                  {%>
                <input type="button" onclick="javascript:eliminar(<%: Model.Id %>, '<%= ResolveUrl("~") %>Recursos/BorrarUsuario', '<%= ResolveUrl("~") %>Recursos/Usuarios')" value="Eliminar" />
                <%} %>
            <input type="button" onclick="javascript:document.location.href='<%= ResolveUrl("~") %>Recursos/Usuarios'" value="Cancelar" />               
        </p>

  </div>
    <% } %>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadContentPlaceHolder" runat="server">
    <script type="text/javascript" src="<%= ResolveUrl("~") %>Scripts/MicrosoftAjax.js"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~") %>Scripts/MicrosoftMvcAjax.js"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~") %>Scripts/MicrosoftMvcValidation.js"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~") %>Scripts/helpers.js"></script>

    <script language="javascript" type="text/javascript">
        $(function () {
            $("#navbar").hide();
        });
    </script>

    <script language="javascript" type="text/javascript">
        // run the function below once the DOM(Document Object Model) is ready 
        $(document).ready(function () {
            // trigger the function when clicking on an assigned element
            $(".toggle").click(function () {
                // check the visibility of the next element in the DOM
                if ($(this).next().is(":hidden")) {
                    $(this).next().slideDown("fast"); // slide it down
                } else {
                    $(this).next().hide(); // hide it
                }
            });
        });
    </script>

    <title>Nuevo Grupo</title>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="MenuContentPlaceHolder" runat="server">
</asp:Content>
